package com.gxa.community.admin.mapper.content;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gxa.community.core.pojo.domain.TopicInfo;
import com.gxa.community.core.pojo.dto.content.RelativeGood;
import com.gxa.community.core.pojo.vo.content.TopicVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TopicMapper extends BaseMapper<TopicInfo> {
    //根据专题ID查询关联商品信息（topic_goods与goods_info联查）
    List<RelativeGood> selectRelativeGoodsByTopicId(Integer id);

    //新增专题信息表
    Integer insertTopicInfo(TopicVo topicVo);
    //新增专题商品表信息
    Integer insertTopicGoods(RelativeGood relativeGood);

    //修改专题，先删除topic_goods表中相关信息
    Integer deleteTopicGoodsByTopicId(Integer topicId);
    //再修改topic_info表中相关信息
    Integer updateTopicInfo(TopicVo topicVo);

    //删除专题
    Integer deleteTopicInfoById(Integer id);
    //再调用  Integer deleteTopicGoodsByTopicId(Integer topicId);删除topic_goods表中相关信息

    //修改专题状态
    Integer updateTopicInfoStatus(@Param("roleId") Integer roleId,@Param("status") Integer status);
}
